<% breadcrumb :lottery_prize_rule, @event_lottery_prize %>

<div class="row">
  <div class="col-lg-12">
    <div class="ibox float-e-margins">
      <div class="ibox-title">
        <h5>抽奖规则设置</h5>
      </div>
      <div class="ibox-content">
        <%= form_tag event_event_lottery_prize_update_lottery_prize_rule_path(current_event, @event_lottery_prize), method: 'patch', class: "form-horizontal" %>
          <div class="form-group">
            <label class="form-lable col-md-2">允许用户重复中奖</label>
            <div class="col-md-4">
              <input type="checkbox" name="allow_attendee_repeat_take_in" class="form-control" <%= "checked='true'" if @event_lottery_prize.allow_attendee_repeat_take_in %> value="true"></input>
            </div>
          </div>
          <hr >

          <div class="form-group">
            <label class="form-lable col-md-2">
              设置按人抽奖
            </label>
            <div class="col-md-4">
              <input type="radio" class="form-control" name="lottery_prize_method" <%= "checked='true'" if 'attendee'==@event_lottery_prize.lottery_prize_method %> value="attendee" />
            </div>
          </div>
          <div class="form-group">
            <label class="form-lable col-md-2">
              设置按公司抽奖
            </label>
            <div class="col-md-4">
              <input type="radio" class="form-control" name="lottery_prize_method" <%= "checked='true'" if 'attendee'!=@event_lottery_prize.lottery_prize_method %> value="company" />
            </div>
          </div>
          <hr >

          <% @categories.each do |category|%>
            <div class="form-group">
              <label class="form-label col-md-2">
                <%= "允许#{category.name}参与抽奖" %>
              </label>
              <div class="col-md-4">
                <% checked = @lottery_prize_category_ids.include? category.id %>
                <input type="checkbox" name="category_id[]" <%= "checked='true'" if checked %> value=<%= category.id %> class="form-control">
              </div>
            </div>
          <% end %>

          <div class="row" style="margin-top: 50px">
            <input class="col-md-1 col-md-offset-2 btn btn-primary" type="submit" value="确定" />
          </div>
        </form>

      </div>
    </div>
  </div>
</div>
